package com.toolsder.demo.spring.security.jwt.entity.database;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Set;

/**
 * created by 猴子请来的逗比 On 2020/7/20
 * <p>
 * 管加工2分厂角色
 *
 * @author by 猴子请来的逗比
 */
@Entity
@Data
@NoArgsConstructor
@Accessors(chain = true)
@JsonIgnoreProperties(value = "gjg2Resources")
@EqualsAndHashCode(of = {"id"})
public class Role implements Serializable {

    private static final long serialVersionUID = 3977815537063774835L;

    @Id
    private Long id;

    /**
     * 角色代码
     */
    private String roleCode;

    /**
     * 角色名称
     */
    private String roleName;

    /**
     * 描述
     */
    private String descpt;



    /**
     * 角色资源列表
     */
    @ManyToMany
    @JoinTable(name = "role_resources",
            joinColumns = @JoinColumn(name = "role_id"),
            inverseJoinColumns = @JoinColumn(name = "resources_id"))
    private Set<Resources> resources;
}
